from pos import Position
import items,charectors

char2wall={
        '#':items.UnDestroyableWall,
        'X':items.DestroyableWall,
        '*':charectors.BasicCharector,
        '$':items.Gold,
        '^':items.Exit,
        }
    
def loadMap(world,map_):

    res=[]
    size=world.display.unitsize

    for rowno,row in enumerate(map_):
        for colno,char in enumerate(row):

            if char in ['.',' '] :
                continue

            res.append(
                    char2wall[char](
                        world,
                        Position(rowno*size[0]+size[0]/2,colno*size[1]+size[1]/2)
                        )
                    )

    world.display.size=(len(map_)*size[0]+size[0]/2,len(map_[0])*size[1]+size[1]/2)

    return res

